import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/async_learn/async_loading.dart';
import 'package:flutter_app/counter/counter_demo.dart';
import 'package:flutter_app/flutter_other/image_loading.dart';
import 'package:flutter_app/flutter_other/json_test.dart';
import 'package:flutter_app/flutter_other/other_api_test.dart';
import 'package:flutter_app/openeye/app_init.dart';
import 'package:flutter_app/openeye/open_eye_home_page.dart';
import 'package:flutter_app/router/unit_router.dart';
import 'package:flutter_app/sqflite/sqflite_page.dart';
import 'package:flutter_app/stateLearn/navigator_learn.dart';
import 'package:flutter_app/stateLearn/state_page.dart';
import 'package:flutter_app/ui/animation1.dart';
import 'package:flutter_app/ui/container_test.dart';
import 'package:flutter_app/ui/demo_flow_menu.dart';
import 'package:flutter_app/ui/demo_flow_pop_menu.dart';
import 'package:flutter_app/ui/demojuejinme/demo_jujin_me.dart';
import 'package:flutter_app/ui/home_page.dart';
import 'package:flutter_app/ui/page_test.dart';
import 'package:flutter_app/ui/page_two.dart';
import 'package:flutter_app/ui/part_navigator.dart';
import 'package:flutter_app/ui/share_info.dart';
import 'package:flutter_app/ui/share_page.dart';
import 'package:flutter_app/ui/share_page_first.dart';
import 'package:flutter_app/ui/splash.dart';
import 'package:flutter_app/ui/status_manager.dart';
import 'package:flutter_app/ui/storage_test.dart';
import 'package:get/get.dart';

import 'getx/all_controller_binding.dart';
import 'getx/getview_one_test.dart';
import 'getx/getview_two_test.dart';
import 'getx/getx_test.dart';
import 'net/http_test.dart';
import 'ui/in_app_webiew_example.dart';
import 'ui/inapp_webview.dart';
import 'ui/overlay_tool_page.dart';
import 'ui/pic_select.dart';
import 'ui/plugin_test.dart';
import 'ui/refresh_dart.dart';
import 'ui/save_pic_test.dart';
import 'ui/shimmer_test.dart';
import 'ui/sign_args_page.dart';
import 'ui/slidable_test.dart';
import 'ui/sliver_view_test.dart';
import 'ui/text_rich_test.dart';
import 'ui/update_pop_test.dart';
import 'ui/web_flutter.dart';
import 'ui/webview_test.dart';
import 'utils/analysis.dart';
import 'widget/app_float_box.dart';

void main() {

  runApp(const MyApp());
  // if (Platform.isAndroid) {
  //   SystemChrome.setSystemUIOverlayStyle(
  //       const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
  // }
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: AppInit.init(),
      builder: (context, snapshot) {
        return GetMaterialApp(
          navigatorObservers: [AnalySis()],
          initialBinding: AllControllerBinding(),
          theme: ThemeData(fontFamily: 'ComicNeue',splashColor: Colors.transparent,highlightColor: Colors.transparent),
          onGenerateRoute: UnitRouter.getInstance().generateRoute,
          routes: {
            "/": (context) => const HomePage(),
            "page2": (context) =>  const PageTwo(),
            "animation1": (context) => const Animation1(),
            "sharePage": (context) => const SharePage(),
            "sharePageFirst": (context) => const SharePageFirst(),
            "statusManager": (context) => const StatusManager(),
            "openEyeHome": (context) => const OpenEyeHome(),
            "statePage": (context) => const StatePage(),
            "navigatorLearn": (context) => const NavigatorLearn(),
            "asyncLoad": (context) => const AsyncLoad(),
            "otherAPITest": (context) => const OtherAPITest(),
            "jsonTest": (context) => const JsonTest(),
            "imageLoading": (context) => const ImageLoading(),
            "counter": (context) => const Counter(),
            "pageTest": (context) => const PageTest(),
            "demoJueJInMe": (context) => const DemoJueJInMe(),
            "demoFlowPopMenu": (context) => const DemoFlowPopMenu(),
            "demoFlowMenu": (context) => const DemoFlowMenu(),
            "containerTest": (context) => const ContainerTest(),
            "partNavigator": (context) => const PartNavigator(),
            "getXTest": (context) => const GetXTest(),
            "sqfLite": (context) => const SqfLite(),
            "Splash": (context) => const Splash(),
            "picSelect": (context) => PicSelect(),
            "webViewExample": (context) =>  WebViewExample(),
            "shareInfo": (context) => const ShareInfo(),
            "httpTest": (context) => const HttpTest(),
            "getViewOneTest": (context) => GetViewOneTest(),
            "getViewTwoTest": (context) => const GetViewTwoTest(),
            "sliverViewTest": (context) => const SliverViewTest(),
            "storageTest": (context) => const StorageTest(),
            "shimmerTest": (context) =>  ShimmerTest(),
            "slidableTest": (context) =>  SlidableTest(),
            "refreshDart": (context) =>  RefreshDart(),
            "WebFlutter": (context) =>  WebFlutter(),
            "InAppWebViewTest": (context) =>  InAppWebViewTest(),
            "InAppWebViewExampleScreen": (context) =>  InAppWebViewExampleScreen(),
            "PluginTest": (context) =>  const PluginTest(),
            "SavePicTest": (context) =>  const SavePicTest(),
            "updatePopTest": (context) =>   UpdatePopTest(),
            "overlayToolPage": (context) =>   OverlayToolPage(),
            "textRichTest": (context) =>   TextRichTest(),
            "signArgsPage": (context) =>   SignArgsPage(),
          },
        );
      },
    );
  }
}
